#include "apiAudio.h"
#include "Audio.h"

apiAudio::apiAudio(Audio *audio, QObject *parent) : _audio(audio), QObject(parent)
{
	initConnect();
}

apiAudio::~apiAudio()
{

}

void								apiAudio::initConnect()
{
	connect(_audio, SIGNAL(newPacket(Packet &)), this, SLOT(handleNewPacket(Packet &)));
	connect(_audio, SIGNAL(newSound(SoundPacket *)), this, SLOT(handleNewSound(SoundPacket *)));
}

void								apiAudio::startRecord()
{
	_audio->getRecorder().start();
}

void								apiAudio::stopRecord()
{
	_audio->getRecorder().stop();
}

void								apiAudio::handleNewPacket(Packet &pkg)
{
	emit newPacket(pkg);
}

void								apiAudio::handleNewSound(SoundPacket*pkg)
{
	emit newSound(pkg);
}

Encoder &							apiAudio::getEncoder() const
{
	return _audio->_encoder;
}